package com.etrans.web.gps.business.email.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.etrans.web.gps.base.controller.BaseController;
import com.etrans.web.gps.util.Config;

@Controller
@RequestMapping("/mail/*")
public class mailController extends BaseController{

	@Autowired
	private Config config;
	
	@ResponseBody
	@RequestMapping("enterprise/sendMailByWeek.html")
	public ModelAndView sendMailByEnterprise(String startStr , String endStr,String id){
		ModelAndView mv =new ModelAndView();
		mv.addObject("startStr",startStr);
		mv.addObject("endStr",endStr);
		mv.addObject("id",id);
		mv.addObject("url",config.system_path+"/mail/enterprise/sendMailByWeek.html");
		mv.setViewName("/views/business/email/enterpriseTemplate");
		return mv;
		
	}
	
	@ResponseBody
	@RequestMapping("enterprise/sendMailByMonth.html")
	public ModelAndView sendMailByMonth(String previousMonth,String id){
		ModelAndView mv =new ModelAndView();
		mv.addObject("previousMonth",previousMonth);
		mv.addObject("id",id);
		mv.addObject("url",config.system_path+"/mail/enterprise/sendMailByMonth.html");
		mv.setViewName("/views/business/email/enterpriseTemplate");
		return mv;
		
	}
	
	@ResponseBody
	@RequestMapping("area/sendMailByArea.html")
	public ModelAndView sendMailByArea(String areaId,String year,String timeType,String detail,
			String queryType,String queryTime){
		ModelAndView mv =new ModelAndView();
		mv.addObject("year",year);
		mv.addObject("timeType",timeType);
		mv.addObject("detail",detail);
		mv.addObject("areaId",areaId);
		mv.addObject("queryType",queryType);
		mv.addObject("queryTime",queryTime);
		mv.addObject("url",config.system_path+"/mail/area/areaAnalyzes.html");
		mv.setViewName("/views/business/email/areaTemplate");
		return mv;
		
	}
	
	/**
	 * 查看平台考核邮件提醒记录(网页邮件)
	 * @param platformId 平台id
	 * @param timeType	   时间类型（"week"/"month"）
	 * @param time		   时间（第几周/月份）
	 * @param queryTime  考核信息时间
	 * @return ModelAndView
	 */
	@RequestMapping("platform/queryPlatQCEmailRemind.html")
	public ModelAndView queryPlatQCEmailRemind(String platformId,String timeType,String year,String time,String queryTime){
		ModelAndView mv =new ModelAndView();
		mv.addObject("platformId",platformId);
		mv.addObject("timeType",timeType);
		mv.addObject("year",year);
		mv.addObject("time",time);
		mv.addObject("queryTime",queryTime);
		mv.addObject("pic",config.imagePath);
		mv.addObject("url",config.system_path+"/mail/platform/platformQC.html");
		mv.setViewName("/views/business/email/platformQC");
		return mv;
	}
	
}
